package apace.commons.email;

import java.net.URL;

import org.apache.commons.mail.HtmlEmail;

public class EmailTest {
// qqwwLZQno1*6
	public static void main(String[] args) throws Exception {
		HtmlEmail email = new HtmlEmail();
		email.setSSLOnConnect(true);
		email.setSmtpPort(25);
		email.setHostName("smtp.qq.com");
		email.setAuthentication("591958995@qq.com", "qqwwMFF1@8");
		email.addTo("770473893@qq.com", "杨成静");
		email.setFrom("591958995@qq.com", "Me");
		email.setSubject("Java发送邮件测试"); // 标题
		email.setCharset("GB2312"); // 设置Charset
		URL url;
		String cid;
		url = new URL("http://www.apache.org/images/asf_logo_wide.gif");
		cid = email.embed(url, "Apache logo");
		email.setHtmlMsg("<html>The apache logo - <img src=\"cid:"+cid+"\"></html>");
		email.setMsg("这是一封Java程序发出的测试邮件,带附件。"); // 内容
		email.send();
	}

}
